package moe.loliserver.utils;

import moe.loliserver.LanguagesMap;

import java.util.ArrayList;
import java.util.Arrays;

public class CheckJDKVersionUtil {

    public Float JAVA_VERSION = Float.parseFloat(System.getProperty("java.class.version"));
    public ArrayList<String> JDK16 = new ArrayList(Arrays.asList("--add-exports=java.base/sun.security.util=ALL-UNNAMED", "--add-opens=java.base/java.util.jar=ALL-UNNAMED", "--add-opens=java.base/java.lang=ALL-UNNAMED"));

    public CheckJDKVersionUtil(){
        if (JAVA_VERSION == 52F || JAVA_VERSION == 55F){
            System.out.println(LanguagesMap.i18nGet("loli.compatiblejava"));
        }else if (JAVA_VERSION == 60F) {
            System.out.println(LanguagesMap.i18nGet("startWithJDK16"));
            System.out.println(LanguagesMap.i18nGet("startWithJDK16_1"));
            for (String s : JDK16) {
                System.out.println(String.format(LanguagesMap.i18nGet("j16Args"), s));
            }
        } else {
            System.out.println(LanguagesMap.i18nGet("loli.errorjava"));
            System.exit(0);
        }
    }
}
